@echo off
REM PostgreSQL Database Viewer - Windows Launcher
REM This script launches the database viewer on Windows

echo Starting PostgreSQL Database Viewer...
echo.

REM Check if Python is installed
python --version >nul 2>&1
if errorlevel 1 (
    echo Error: Python is not installed or not in PATH
    echo Please install Python 3.7 or higher from https://python.org
    pause
    exit /b 1
)

REM Check if required files exist
if not exist "tkinter_viewer.py" (
    echo Error: tkinter_viewer.py not found
    echo Please ensure you are in the correct directory
    pause
    exit /b 1
)

REM Install dependencies if needed
echo Checking dependencies...
pip install -r requirements.txt >nul 2>&1

REM Launch the application
echo Launching Database Viewer...
python tkinter_viewer.py

REM Keep window open if there's an error
if errorlevel 1 (
    echo.
    echo An error occurred. Press any key to exit.
    pause
)
